﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using App.Interface;
using Newtonsoft.Json;

namespace App.Realization
{
    public class KeShitmpl : IKeShi
    {
        public void AddKeShi(string ksmc)
        {
            var result = HttpClientHelper.GetResponse(System.Web.Configuration.WebConfigurationManager.AppSettings["schoolapi"] + "/api/KeShi/AddKeShi?ksmc=" + ksmc);
        }

        public void DelKeShi(int ksid)
        {
            var result = HttpClientHelper.GetResponse(System.Web.Configuration.WebConfigurationManager.AppSettings["schoolapi"] + "/api/KeShi/DelKeShi?ksid=" + ksid);
        }

        public string GetKeShiZhiWu(int ksid)
        {
            var result = HttpClientHelper.GetResponse(
                System.Web.Configuration.WebConfigurationManager.AppSettings["schoolapi"] + "/api/KeShi/GetKeShiZhiWus?ksid=" + ksid);
            return result;
        }
        
        public string GetKeShiZhiWuOption(int ksid)
        {
            var result = HttpClientHelper.GetResponse(
                System.Web.Configuration.WebConfigurationManager.AppSettings["schoolapi"] + "/api/KeShi/GetKeShiZhiWusOption?ksid=" + ksid);
            return result;
        }
        public string GetGongZuoJiHuaList()
        {
            var result = HttpClientHelper.GetResponse(
                System.Web.Configuration.WebConfigurationManager.AppSettings["schoolapi"] + "/api/MoBan/GetGZJHMB");
            return result;
        }

        public string GetJiXiaoList()
        {
            var result = HttpClientHelper.GetResponse(
                System.Web.Configuration.WebConfigurationManager.AppSettings["schoolapi"] + "/api/MoBan/GetJiXiaos");
            return result;
        }

        public void AddZhiWu(int ksid, int zwid)
        {
            dynamic obj = new { ksid = ksid, zwid = zwid };
            string str = JsonConvert.SerializeObject(obj);
            var reslut = HttpClientHelper.PostResponse(System.Web.Configuration.WebConfigurationManager.AppSettings["schoolapi"] + "/api/KeShi/ZhiWuRelationKeShi", str);
        }

        //public void EditZhiWu(int ksid, string zwid, int gzjhid)
        //{
        //    var result = HttpClientHelper.GetResponse(System.Web.Configuration.WebConfigurationManager.AppSettings["schoolapi"] + "/api/KeShi/EditZhiWu?ksid=" + ksid + "&zwid=" + zwid + "&zwmc=" + zwmc + "&gzjhid=" + gzjhid + "&jxkhid=" + jxkhid + "&pid=" + pid);
        //}

        public void DelZhiWu(int ksid,int zwid)
        {
            dynamic obj = new { ksid = ksid, zwid = zwid };
            string str = JsonConvert.SerializeObject(obj);
            var reslut = HttpClientHelper.PostResponse(System.Web.Configuration.WebConfigurationManager.AppSettings["schoolapi"] + "/api/KeShi/DelKeShiZhiWu", str);
        }

        public string GetQuanXian()
        {
            var result = HttpClientHelper.GetResponse(System.Web.Configuration.WebConfigurationManager.AppSettings["schoolapi"] + "/api/KeShi/GetPowerTrees");
            return result;
        }

        public void UpdateZhiWuPowertrees(int ksid, int zwid, string ptmc)
        {
            dynamic obj = new { ksid= ksid,zwid = zwid, power = ptmc };
            string str = JsonConvert.SerializeObject(obj);
            var reslut = HttpClientHelper.PostResponse(System.Web.Configuration.WebConfigurationManager.AppSettings["schoolapi"] + "/api/KeShi/ZhiWuRelationPower", str);
        }

        public string GetAllKeShiList()
        {
            var result = HttpClientHelper.GetResponse(System.Web.Configuration.WebConfigurationManager.AppSettings["schoolapi"] + "/api/KeShi/GetAllKeShis");
            return result;
        }

        public void UpdateKeShi(int ksid, string ksmc)
        {
            var result = HttpClientHelper.GetResponse(System.Web.Configuration.WebConfigurationManager.AppSettings["schoolapi"] + "/api/KeShi/UpdateKeShi?ksid=" + ksid + "&ksmc=" + ksmc);
        }

        public void KaoHeBiaoRelationZhiWu(int ksid, int zwid, int khbid)
        {
            dynamic obj = new { ksid = ksid, zwid = zwid , khbid = khbid };
            string str = JsonConvert.SerializeObject(obj);
            var reslut = HttpClientHelper.PostResponse(System.Web.Configuration.WebConfigurationManager.AppSettings["schoolapi"] + "/api/KeShi/KaoHeBiaoRelationZhiWu", str);
        }

        public void DelKaoHeBiaoRelationZhiWu(int ksid, int zwid, int khbid)
        {
            dynamic obj = new { ksid = ksid, zwid = zwid, khbid = khbid };
            string str = JsonConvert.SerializeObject(obj);
            var reslut = HttpClientHelper.PostResponse(System.Web.Configuration.WebConfigurationManager.AppSettings["schoolapi"] + "/api/KeShi/DelKaoHeBiaoRelationZhiWu", str);
        }

        public string GetZhiWuKaoHeBiao(int ksid, int zwid)
        {
            dynamic obj = new { ksid = ksid, zwid = zwid};
            string str = JsonConvert.SerializeObject(obj);
            var reslut = HttpClientHelper.PostResponse(System.Web.Configuration.WebConfigurationManager.AppSettings["schoolapi"] + "/api/KeShi/GetZhiWuKaoHeBiao", str);
            return reslut;
        }
    }
}
